<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  <title>&lrm;</title>
  <link rel="stylesheet" href="/mobile/css/index.css" />
  <link rel="stylesheet" href="/mobile/css/quill.core.css" />
  <link rel="stylesheet" href="/mobile/css/quill.snow.css" />
  <link rel="stylesheet" href="/mobile/css/quill.bubble.css" />
  <script src="/mobile/js/vue.js"></script>
  <script src="/mobile/js/axios.min.js"></script>
  <script src="/mobile/js/vant.min.js"></script>
  <script src="/mobile/js/crypto-js.js"></script>
  <script src="/mobile/js/aes.js"></script>
  <script src="/mobile/js/common.js"></script>
  <style>
  * {
    margin: 0;
    padding: 0;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+/Edge */
    user-select: none; /* Standard syntax */
    list-style: none;
    color: #fff!important;
    word-break: break-all;
  }
  #app {
    background: #05071D;
    min-height: 100vh;
    box-sizing: border-box;
    background-repeat: no-repeat;
    background-position: top center;
    background-size: contain;
    font-size: 14px!important;
  }
  .poster {
    font-size: 0;
  }
  .poster img {
    width: 100%;
  }
  .ql-editor {
    padding: 10px;
  }
  .ql-editor a {
    text-decoration: underline;
  }
  
  </style>
</head>

<body>
  <div id="app">
    <div v-if="type === 2" class="poster" v-html="content"></div>
    <div v-else class="ql-editor" v-html="content"></div>
  </div>
  <script>
  new Vue({
    el: '#app',
    data: {
      id: null,
      loading: false,
      content: '',
      type: 0
    },
    created() {
      const parse = (queryStr) => {
        const str = queryStr.replace(/^\?/, '')
        return str.split('&').reduce((pre, key) => {
          const [k, v] = key.split('=')
          pre[decodeURIComponent(k)] = decodeURIComponent(v)
          return pre
        }, {})
      }
      var data = parse(location.search)
      if (data.id) {
        if (data.id === '5') {
          document.getElementById('app').style.background = '#0D0E24'
        }
        this.id = data.id
        this.getData()
      }
    },
    methods: {
      getData() {
        this.loading = true
        var query = `id=${this.id}`
        var str = ISCRYPT ? `args=${encrypt(query)}` : query
        request.get(`/api/business/app/w/systemPortalPost/findById?${str}`).then(res => {
          console.log(res)
          var content = res.data.content
          this.type = res.data.type
          if (this.id === '11') {
            request.get('/api/pay/finance/systemPar/getWithdrawPar').then(data => {
              console.log(data)
              content = content.replace('(1)', data.data.userInitDivideRatio)
              content = content.replace('(2)', data.data.userInitDivideRatio/100)
              content = content.replace('(3)', parseInt(180*data.data.userInitDivideRatio/100))
              content = content.replace('(4)', Number(data.data.minWithdrawMoney) * Number(data.data.withdrawRatio))
              content = content.replace('(5)', data.data.withdrawRatio)
              content = content.replace('(6)', data.data.withdrawCommission)
              content = content.replace('(7)', data.data.withdrawFixation)
              content = content.replace('(8)', data.data.withdrawCommission)
              content = content.replace('(9)', 10000*data.data.withdrawCommission/100)
              content = content.replace('(10)', data.data.withdrawFixation)
              content = content.replace('(11)', parseInt(10000 - 10000*data.data.withdrawCommission/100 - data.data.withdrawFixation))
              content = content.replace('(12)', ((10000 - 10000*data.data.withdrawCommission/100 - data.data.withdrawFixation) / data.data.withdrawRatio).toString().match(/^\d+(?:.\d{0,2})?/)[0])
              this.content = content
            })
          } else {
            this.content = content
          }
          
          document.title = res.data.title
        }).finally(() => {
          this.loading = false
        })
      },
    }
  })
  </script>
</body>

</html>